package ict.kth.se.model.repository;

import ict.kth.se.exceptions.EntityAlreadyExistsInDBException;
import ict.kth.se.exceptions.EntityDoesntExistInDBException;
import ict.kth.se.model.Competence;
import ict.kth.se.model.Role;

import java.sql.SQLException;
import java.util.List;

public interface CompetenceRepository {

	/**
	 * Get Competence by id
	 * @param id Id of competence
	 * @return Found competence
	 */
	public Competence getCompetenceById(Long id) throws SQLException;
	
	/**
	 * Get Competence by name
	 * @param name_se Name of competence on swedish
	 * @param name_en Name of competence on english
	 * @return Found competence
	 */
	public Competence getCompetenceByNames(String name_se, String name_en) throws SQLException;
	
	/**
	 * Get all competences
	 * @return Found competences
	 */
	public List<Competence> getAllCompetences() throws SQLException;
	
	/**
	 * This method removes one competence from database (by it's ID)
	 * @param competence The competence to be removed
	 * @throws EntityDoesntExistInDBException If competence doesn't exist in database
	 * @throws SQLException
	 */
	public void removeCompetence(Competence competence) throws EntityDoesntExistInDBException, SQLException;
	
	/**
	 * This method adds an competence in DB
	 * @param competence Competence to be added
	 * @return Newly created competence
	 * @throws EntityAlreadyExistsInDBException If such competence already exists in DB (by name)
	 * @throws SQLException
	 */
	public Competence createCompetence(Competence competence) throws EntityAlreadyExistsInDBException, SQLException;
	
	/**
	 * This method updates an competence in DB
	 * @param competence Competence to be updated
	 * @throws EntityDoesntExistInDBException If such competence doesn't exist in DB (by id)
	 * @throws SQLException
	 */
	public void updateCompetence(Competence competence) throws EntityDoesntExistInDBException, SQLException;
}
